<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%><!DOCTYPE html>
<html lang="en">
<head>
    <base href="${BaseContext}">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta name="keywords" content="Web前端视频教程,大数据视频教程,HTML5视频教程,UI视频教程,PHP视频教程,java视频教程,python基础教程">
    <meta name="description"
          content="智游教育在线课程视频,为您提供java,python,HTML5,UI,PHP,大数据等学科经典视频教程在线浏览学习,精细化知识点解析,深入浅出,想学不会都难,智游教育,学习成就梦想！">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/base.css">
    <link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
    <script src="${pageContext.request.contextPath}/js/jquery-1.8.3.js"></script>
    <link rel="icon" href="favicon.png" type="image/png">
    <title>忘记密码</title>

</head>

<body>
<header>
    <div class="container">
        <img src="${pageContext.request.contextPath}/wengine-vpn/js/image/logo.png" alt="">
    </div>
</header>
<main>
    <div class="container">
        <form id="form" class="ma" action="${pageContext.request.contextPath}/pwd/forget.do" method="post">
            <div class="form_header">
                <div class="form_title">
                    <h2>找回密码</h2>
                </div>
            </div>
            <div class="form_body">
                <input id="phoneNum1" type="test" placeholder="请输入手机号码" name="phoneNum" value="${phoneNum}"><br><br>
                <input type="text" placeholder="请输入验证码" name="jspcode"><input type="button" value="获取验证码" onclick="submitEmail();">
                <br><br>
                <input type="submit" value="提&#x3000;&#x3000;交" class="btn btn-success">
                <br><br>
                <h4 id="yourPassword">您的密码为 : ${password}</h4>
                <span style="color: #ac2925">${msg}</span>
            </div>
        </form>
        <br>
        <hr>
        <form id="form2" class="ma" action="${pageContext.request.contextPath}/pwd/update.do" method="post">
            <div class="form_header">
                <div class="form_title">
                    <h2>修改密码</h2>
                </div>
            </div>
            <div class="form_body">
                <input id="phoneNum2" type="test" placeholder="请输入手机号码" name="phoneNum" value="${phoneNum}">
                <br><br>
                <input type="text" placeholder="请输入验证码" name="jspcode"><input type="button" value="获取验证码" onclick="submitEmail2();">
                <br><br>
                <input type="password" id="regPsw" placeholder="请输入新密码"  >
                <br><br>
                <input type="password" id="regPswAgain" placeholder="请再次输入新密码" name="newPassword" ><span id="passMsg"></span>
                <br>
                <br>
                <input type="submit" value="提&#x3000;&#x3000;交" class="btn btn-success">
                <br>
                <br>
                <h4 >${updatePWDSuccess}</h4>
                <h4 >${updatePWDFailed}</h4>
            </div>
        </form>
    </div>
</main>
<script type="text/javascript">
    function submitEmail(){
      //  alert("手机号1:"+$("#phoneNum1").val())
        $.ajax({
            url: '${pageContext.request.contextPath}/pwd/ajaxSendMsg.do',
            type: 'POST',
            data: {"phoneNum":$("#phoneNum1").val()},
            dataType:"text",
            success:function(data){
                if (data=="success"){
                    alert("发送成功,五分钟后失效!");
                }else {
                    alert("发送失败")
                }
            },
            error:function(){
                alert("服务器正忙!请稍后再试!");
            }
        });
    };
    function submitEmail2(){
        // alert("手机号2:"+$("#phoneNum2").val())
        $.ajax({
            url: '${pageContext.request.contextPath}/pwd/ajaxSendMsg.do',
            type: 'POST',
            data: {"phoneNum":$("#phoneNum2").val()},
            dataType:"text",
            success:function(data){
                if (data=="success"){
                    alert("发送成功,五分钟后失效!");
                }else {
                    alert("发送失败")
                }
            },
            error:function(){
                alert("服务器正忙!请稍后再试!");
            }
        });
    };

</script>
<script type="text/javascript">
    $(function () {
        // alert("1");
        if (null != "${password}" && "${password}" != "") {
            $("#yourPassword").css("display", "block");
        } else {
            $("#yourPassword").css("display", "none");

        }
    });


</script>
</body>
<script type="text/javascript">
    $("#regPswAgain").blur(function(){
        //alert("失去焦点事件生效");
        var pass01= $("#regPsw").val();
        var pass02= $("#regPswAgain").val();
        if(null==pass01 || ""==pass01 || null==pass02 || ""==pass02){
            $("#passMsg").text("密码不能为空").css("color","red");
            regIsCommitPsw =false;
        }else{
            if(pass01!=pass02){
                regIsCommitPsw=false;
                $("#passMsg").text("两次密码输入不一致，请重新输入").css("color","red");
            }else{
                regIsCommitPsw=true;
                $("#passMsg").text("");
            }
        }

    })
</script>
</html>